<%- include('../../shared/includes/head',{ pageTitle: 'Login' }) %>
</head>
<link rel="stylesheet" href="/styles/forms.css">
<link rel="stylesheet" href="/styles/auth.css">
<body>
<%- include('../../shared/includes/header') %>
<main>
    <h1>Login</h1>
    <% if(inputData.errorMessage){ %>
        <section class="alert">
            <h2>Invalid Credentials</h2>
            <p><%= inputData.errorMessage %></p>
        </section>
    <% } %>
    <form action="/login" method="POST">
        <input type="hidden" name="_csrf"
               value="<%= locals.csrfToken %>">
        <p>
            <label for="email">E-Mail</label>
            <input type="email" id="email"
                   name="email"
                   value="<%= inputData.email %>"
                   required>
        </p>
        <p>
            <label for="password">Password</label>
            <input type="password" id="password"
                   name="password" minlength="6"
                   value="<%= inputData.password %>"
                   required>
        </p>
        <hr>

        <button class="btn">Login</button>
        <p id="switch-form"><a href="/signup">Create
                a new user</a></p>
    </form>
</main>

<%- include('../../shared/includes/footer') %>